﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EXAMPLE
{
    class Human
    {
        private int age;
        public int Age
        {
            get //property h.Age => get
            {
                return this.age; //na toq chovek age-to
            }
            set //h.Age=60;
            {
                this.age=value;
                this.UpdateState();
            }
        }
        public string name;

        public string state;

        public Human(int age, string name)
        {
            this.age = age;
            this.name = name;

            UpdateState();

        }

        private void UpdateState()
        {
            if (this.age < 35)
            {
                this.state = "young";

            }
            else if (this.age > 35 && this.age <= 65)
            {
                this.state = "middle-aged";
            }
            else
            {
                this.state = "past middle-aged";
            }
        }
        public void GetOlder()
        {
            this.Age++;
        }
        public static int GetAverageNumberOfHairs()
        {
            return 100000;
        }
        public static int GetAverage(params Human[] humans)
        {
            int sum = 0;
            foreach (var human in humans)
            {
                sum += human.Age;
            }
            return sum / humans.Length;
        }
    }

    class Program
    {
        static void Main(string[] args)
        {
            Human h = new Human(20,"Goshko");
            h.Age = 30; //dostupvame set-a sus = i toi reagira prez constructora koito e public, no promenlivata e private
            //za da moje da otreagira -> UpdateState();
            h.GetOlder();
            //Console.WriteLine(h.name+" "+h.age+" "+h.state);
            Console.WriteLine(h.name + " " + h.Age + " " + h.state);
            //h.age = 70; //shtot e public i moga da go dostupvam kym set 
            Human volunteer = new Human(90, "Pesho");
            Console.WriteLine(volunteer.name + " " + volunteer.Age + " " + volunteer.state);
            Console.WriteLine(Human.GetAverage(h, volunteer));
    
        }
    }
}
